#!/usr/bin/env bash
set -euo pipefail

# Project root = this script directory
cd "$(dirname "$0")"

# Activate venv if present
if [ -d "venv" ] && [ -f "venv/bin/activate" ]; then
  # shellcheck disable=SC1091
  source venv/bin/activate
fi

# Fixed start command (no extra parameters) - run in background
nohup python runbot.py \
  --exchange edgex \
  --ticker ETH \
  --quantity 0.1 \
  --take-profit 0.02 \
  --max-orders 40 \
  --wait-time 450 \
  > /dev/null 2>&1 &

echo $! > runbot.pid
echo "Started runbot.py in background (PID $(cat runbot.pid))."


